import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', {
  state: () => {
    return {
      user:{
        id:0,
        name:'',
        avatar:''
      },
      token:''
    }
  },
  actions:{
    login(user:any,token:string){
      this.user=user;
      this.token=token;
    },
    logout(){
      this.user.id=0;
      this.user.name='';
      this.user.avatar='';
      this.token='';
    }
  },
  persist: true,
})